package model

import (
	"time"
)

type BaiduFilePath struct {
	ID           int       `gorm:"primaryKey;column:id;AutoIncrement"`
	CreateAt     time.Time `gorm:"autoCreateTime;type:datetime"`
	UpdatedAt    time.Time `gorm:"autoUpdateTime;type:datetime"`
	Path         string    `gorm:"varchar(500);not null;default:'';comment:'文件位置 /path/asdsad/cc/mpa.mp4'"`
	ParentPath   string    `gorm:"varchar(500);not null;default:'';comment:'路径 /path/asdsad/cc'"`
	IsDir        int       `gorm:"tinyint(2)not null;default:0;comment:'是否为目录'"`
	FrontCover   string    `gorm:"varchar(500);not null;default:'';comment:'图片地址'"`
	IsNew        int       `gorm:"tinyint(2);not null;default:0;comment:'是否为新'"`
	IsHot        int       `gorm:"tinyint(2);not null;default:0;comment:'是否为热'"`
	IsShow       int       `gorm:"tinyint(2);not null;default:0;comment:'是否展示'"`
	IsPersist    int       `gorm:"tinyint(2);not null;default:1;comment:'是否为完结'"`
	CategoryId   int       `gorm:"int(11);not null;default:0;comment:'分类id  3'"`
	CategoryPath int       `gorm:"varchar(50);not null;default:0;comment:'分类路径 1|2|3|'"`
	Title        string    `gorm:"varchar(100);not null;default:'';comment:'标题'"`
	Desc         string    `gorm:"text;comment:'描述 富文本html'"`
	Tips         string    `gorm:"varchar(100);not null;default:'';comment:'简单的描述'"`
	ViewNum      int       `gorm:"int(10);not null;default:0;comment:'查看数量'"`
	WantNum      int       `gorm:"int(10);not null;default:0;comment:'想要的人数'"`
	//Category     Category  `gorm:"foreignKey:ID;ASSOCIATION_FOREIGNKEY:CategoryId"` //references
	Categorys Category `gorm:"foreignKey:category_id;references:ID"`
}

//type Category struct {
//	Categroy CategoryModel.Category `gorm:"foreignKey:id;ASSOCIATION_FOREIGNKEY:category_id"`
//}
//
//type BaiduFilePaths interface {
//	BaiduFilePath
//	Category
//	//Categroy     CategoryModel.Category `gorm:"foreignKey:id;ASSOCIATION_FOREIGNKEY:category_id"`
//}

//新增
//func (m *BaiduFilePath) Add() (int, error) {
//	err := mysql.Gdb.Create(m).Error
//	if err != nil {
//		return 0, err
//	}
//	return m.ID, nil
//}
//
////修改
//func (m *BaiduFilePath) Update(info map[string]interface{}) (int, error) {
//	err := mysql.Gdb.model(m).Where(m).Updates(info).Error
//	if err != nil {
//		return 0, err
//	}
//	return m.ID, nil
//}
//
////详情
//func (m *BaiduFilePath) Detail(res *BaiduFilePath) (*BaiduFilePath, error) {
//	err := mysql.Gdb.First(res).Error
//	if err != nil {
//		return nil, err
//	}
//	return res, nil
//}
//
////列表
//func (m *BaiduFilePath) Paths(where map[string]interface{}) (res *BaiduFilePath, err error) {
//	err = mysql.Gdb.Find(res).Error
//	if err != nil {
//		return nil, err
//	}
//	return res, nil
//}

//想要自增

//浏览量自增

//
